<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"  %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查询商品列表</title>
<% request.setCharacterEncoding("utf-8"); %> 
<script type="text/javascript">

function deleteItem(){
	document.itemsAction.action="${pageContext.request.contextPath}/item/deleteItems.action";
	document.itemsAction.submit();
}

function queryItems(){
	document.itemsAction.action="${pageContext.request.contextPath}/item/findItemsList.action";
	document.itemsAction.submit();
}
</script>
</head>
<body>
	<form name="itemsAction" action="${pageContext.request.contextPath}/item/findItemsList.action" method="post">
	    查询条件：
		<table width="100%" border="1">
		<tr>
		<td>商品名称</td>
		<td><input type="text" name='itemCustom.name' ></td>
		<td>商品价格</td>
		<td><input type="text" name="itemCustom.price" ></td>
		</tr>
		<tr>
		<td>商品描述</td>
		<td><input type="text" name="itemCustom.detail" ></td>
		</tr>
			<tr>			   
				<td>
					<input type="button" value="查询" onclick="queryItems()">
					<input type="button" value="批量删除" onclick="deleteItem()" >
				</td>
			</tr>
		</table>
		商品列表：
		<table border="1">
			<tr><td>选择</td>
				<td>商品名称</td>
				<td>商品价格</td>
				<td>商品描述</td>
				<td>操作1</td>
				<td>操作2</td>
				<td>操作3</td>
			</tr>
			<c:forEach items="${itemList}" var="items">
				<tr><td><input type="checkbox" name="items_id" value="${items.id}" ></td>
					<td>${items.name}</td>
					<td>${items.price}</td>
					<td>${items.detail}</td>
					<td><a href="${pageContext.request.contextPath}/item/editItem.action?id=${items.id}&flag=1" >Controller返回字符串修改</a></td>
					<td><a href="${pageContext.request.contextPath}/item/selectItemById.action?id=${items.id}" >修改</a></td>
					<td><a href="${pageContext.request.contextPath}/item/editItem.action?id=${items.id}&flag=2" >Controller返回void格式</a></td>
				</tr>
			</c:forEach>
		</table>
	</form>
</body>
</html>